package com.itheima.web.controller;

import com.itheima.utils.HotDataByRedis;
import com.itheima.service.report.ReportFormService;
import com.itheima.service.report.ReportFormServiceImpl;
import com.itheima.service.store.*;
import com.itheima.service.store.impl.*;
import com.itheima.service.system.DeptService;
import com.itheima.service.system.ModuleService;
import com.itheima.service.system.RoleService;
import com.itheima.service.system.UserService;
import com.itheima.service.system.impl.DeptServiceImpl;
import com.itheima.service.system.impl.ModuleServiceImpl;
import com.itheima.service.system.impl.RoleServiceImpl;
import com.itheima.service.system.impl.UserServiceImpl;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import java.util.*;

public class BaseServlet extends HttpServlet {
    protected List<String> imgList;
    protected CompanyService companyService;
    protected DeptService deptService;
    protected UserService userService;
    protected CourseService courseService;
    protected CatalogService catalogService;
    protected QuestionService questionService;
    protected QuestionItemService questionItemService;
    protected ModuleService moduleService;
    protected RoleService roleService;
    protected ReportFormService reportFormService;

    @Override
    public void init(ServletConfig config) throws ServletException {
        companyService = new CompanyServiceImpl();
        deptService = new DeptServiceImpl();
        userService = new UserServiceImpl();
        courseService = new CourseServiceImpl();
        catalogService = new CatalogServiceImpl();
        questionService = new QuestionServiceImpl();
        questionItemService = new QuestionItemServiceImpl();
        moduleService = new ModuleServiceImpl();
        roleService = new RoleServiceImpl();
        reportFormService = new ReportFormServiceImpl();

        String[] arr = {"jpg", "png", "gif"};
        imgList = Arrays.asList(arr);

        /**
         * 在redis服务器初始化company 的id 与company的name
         *
         */
        HotDataByRedis.initCompanyData();

    }

}
